#include "MaterialVolumeMap.h"

void
MaterialVolumeMap::SetVolume(DisplayImagePointer inputImage, Material* material)
{
    DisplayImagePointer displayImage = DisplayImagePointer::New();
    displayImage->CopyInformation(inputImage);
    displayImage->ShallowCopy(inputImage);

    ContourFilterPointer contourFilter = ContourFilterPointer::New();
    contourFilter->SetValue(0, m_Material->GetLabel());
    contourFilter->SetInput(displayImage);

    PolyDataNormalsPointer polyDataNormals = PolyDataNormalsPointer::New();
    polyDataNormals->SetFeatureAngle(60.0);
    polyDataNormals->SetInput(contourFilter->GetOutput());

    PolyDataPointer polyData = m_PolyDataNormals->GetOutput();
    m_Map[material->GetLabel()] = polyData;
}

